<?php
class CommonAction extends BaseAction {
    public $group, $ac, $mod;
    public $mid,$member,$mpaccount,$michome;
    public $tplPath = "./Tpl/Mobile/",$tplName = "default";
    function _initialize() {
        parent::_initialize();
        if (I('appid')) {
            $this->mid = I('appid');
        }
        $this->initMichome($this->mid);
    }

    function initMember($mid = 0)
    {
    	if ($mid == 0) return;
    	$Member = M('Member');
    	$member = $Member->find($mid);
    	$this->mid = $member['id'];
    	$this->member = $member;
		$this->assign('member',$this->member);
    }

    function initMichome($mid = 0)
    {
        if ($mid == 0) return;
        $Michome = M('Michome');
        $map['mid'] = $mid;
        $michome = $Michome->where($map)->find();
        if ($michome) {
            $this->michome = $michome;
            $this->assign('michome',$this->michome);
        }
        if ($this->michome['tpl']) {
            $this->tplName = $this->michome['tpl'];
        }
    }

    function initMpaccount($mid = 0)
    {
    	if ($mid == 0) return;
    	$Mpaccount = M('Mpaccount');
    	$map['mid'] = $mid;
    	$mpaccount = $Mpaccount->where($map)->find();
    	$this->mpaccount = $mpaccount;
		$this->assign('mpaccount',$this->mpaccount);
    }
}